<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="referrer" content="never">
    <title>元字符</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
    </style>
</head>
<body>
    
    <script type="text/javascript">
        // 元字符：代表一类内容
        // 常见的： \w \W    \d \D   \s \S  .
        // 单词包含：英文字母/数字/下划线

        var str = "asljdfi a\n45\t64E+/-KPJEO548_7985";

        console.log(str.match(/./g));
        console.log(str.match(/\s/g));
        console.log(str.match(/\S/g));
        
        console.clear();
        console.log(str.match(/\w/g));
        console.log(str.match(/\W/g));
        
        console.clear();
        console.log(str.match(/\d/g));
        console.log(str.match(/\D/g));
        
    </script>
</body>
</html>